﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <!-- layui.css -->
    <script th:src="@{/js/jquery-2.2.4.min.js}"></script>
    <script th:src="@{/js/workutil.js}"></script>
    <link th:href="@{/plugin/layui/css/layui.css}" rel="stylesheet"/>
    <link th:href="@{/css/layui_custom.css}" rel="stylesheet"/>
</head>
<body>
<div class="">
    <table class="layui-hide" id="table-feedback" lay-filter="table-feedback"></table>
</div>

<script type="text/html" id="barSetting">
    <a class="layui-btn layui-btn-xs" lay-event="edit">查看</a>
</script>

<script th:src="@{/plugin/layui/layui.js}"></script>
<script type="text/javascript">
    layui.use('table', function () {
        table = layui.table;
        table.render({
            elem: '#table-feedback'
            , url: '../feedback/list'
            , cols: [[
                {field: 'id', title: 'ID', width:80}
                , {field: 'username', title: '用户'}
                , {field: 'title', title: '标题'}
                , {field: 'created', title: '时间', sort: true}
                , {fixed: 'right', width: 100, align: 'center', toolbar: '#barSetting'}
            ]]
            , page: true
            ,pageauto:true
            , height:'full-20',
            row: function (item) {
                item.created = workUtils.toDate(item.created);
                item.username = item.user.name;
                return item;
            }
        });
        //监听工具条
        table.on('tool(table-feedback)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                workUtils.put("id", data.id);
                workUtils.open({url: "../web/admin/feedbackshow.html", title: "详情"});
            }
        });
    });
</script>
</body>
</html>